package atom;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : AtomicIntegerDemo
 * @Author : 54061
 * @Date: 2022/2/16 21:08
 */
public class AtomicIntegerDemo {
    public static void main(String[] args) {
        //创建对象
        AtomicInteger ai = new AtomicInteger(10);
        System.out.println("ai = " + ai);

        int result = ai.getAndIncrement();
        System.out.println("ai = " + ai);
        System.out.println(result);

        int result1 = ai.incrementAndGet();
        System.out.println("ai = " + ai);
        System.out.println("result1 = " + result1);
    }

}
